package com.zhehekeji.opsys.api.webservice.server;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;

import com.zhehekeji.opsys.api.resp.GetDayVoteRecordCountResp;
import com.zhehekeji.opsys.api.resp.GetPeriodVoteRecordCountResp;
import com.zhehekeji.opsys.api.resp.GetVoteListResp;
import com.zhehekeji.opsys.api.resp.GetVotePlayerCountOnlyResp;
import com.zhehekeji.opsys.api.resp.GetVotePlayerListOnlyResp;
import com.zhehekeji.opsys.api.resp.GetVotePlayerListResp;
import com.zhehekeji.opsys.api.resp.GetVotePlayerResp;
import com.zhehekeji.opsys.api.resp.GetVoteQrCodeDetailResp;
import com.zhehekeji.opsys.api.resp.GetVoteRecordListResp;
import com.zhehekeji.opsys.api.resp.GetVoteRegionDetailResp;
import com.zhehekeji.opsys.api.resp.GetVoteRegionListResp;
import com.zhehekeji.opsys.api.resp.GetVoteResp;
import com.zhehekeji.opsys.api.resp.LuckyVoteResp;
import com.zhehekeji.opsys.api.resp.VerifyInviteCodeResp;

/**
 * @ClassName VoteManager
 * @Description 投票管理接口
 * @author chenweiliu chenwei.liu@163.com
 * @date 2016-3-16   上午11:18:08
 */
@Path(value="/")
@WebService
@CrossOriginResourceSharing(allowAllOrigins=true)
public interface VoteManager {
	
	/**
	 * 获取投票活动详情
	 * @param voteCode
	 * @return
	 */
	@GET
	@Path(value="getVote")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVote",operationName="getVote")
	GetVoteResp getVote(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode);
	
	/**
	 * 获取投票活动列表
	 * @param cpCode
	 * @return
	 */
	@GET
	@Path(value="getVoteList")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVoteList",operationName="getVoteList")
    GetVoteListResp getVoteList(@WebParam(name="cpCode")@QueryParam(value="cpCode")Long cpCode);
	
	/**
	 * 
	* @Title: getVotePlayerList 
	* @Description: 获取参赛选手
	* @param voteCode
	* @param regionCode
	* @param status
	* @param sortName
	* @param sortOrder
	* @param firstIndex
	* @param maxResult
	* @return 
	* @return GetVotePlayerListResp 
	* @throws
	 */
	@GET
	@Path(value="getVotePlayerList")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVotePlayerList",operationName="getVotePlayerList")
    GetVotePlayerListResp getVotePlayerList(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
                                            @WebParam(name="regionCode")@QueryParam(value="regionCode")String regionCode,
                                            @WebParam(name="status")@QueryParam(value="status")int status,
                                            @WebParam(name="sortName")@QueryParam(value="sortName")String sortName,
                                            @WebParam(name="sortOrder")@QueryParam(value="sortOrder")String sortOrder,
                                            @WebParam(name="firstIndex")@QueryParam(value="firstIndex")int firstIndex,
                                            @WebParam(name="maxResult")@QueryParam(value="maxResult")int maxResult);
	
	@GET
	@Path(value="getVotePlayerListOnly")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVotePlayerListOnly",operationName="getVotePlayerListOnly")
	GetVotePlayerListOnlyResp getVotePlayerListOnly(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
			@WebParam(name="regionCode")@QueryParam(value="regionCode")String regionCode,
			@WebParam(name="status")@QueryParam(value="status")int status,
			@WebParam(name="sortName")@QueryParam(value="sortName")String sortName,
			@WebParam(name="sortOrder")@QueryParam(value="sortOrder")String sortOrder,
			@WebParam(name="firstIndex")@QueryParam(value="firstIndex")int firstIndex, 
			@WebParam(name="maxResult")@QueryParam(value="maxResult")int maxResult);
	
	@GET
	@Path(value="getVotePlayerListOnlyByVoteId")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVotePlayerListOnlyByVoteId",operationName="getVotePlayerListOnlyByVoteId")
	GetVotePlayerListOnlyResp getVotePlayerListOnlyByVoteId(@WebParam(name="voteId")@QueryParam(value="voteId")long voteId,
			@WebParam(name="firstIndex")@QueryParam(value="firstIndex")int firstIndex, 
			@WebParam(name="maxResult")@QueryParam(value="maxResult")int maxResult);
	
	@GET
	@Path(value="getVotePlayerCountOnly")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVotePlayerCountOnly",operationName="getVotePlayerCountOnly")
    GetVotePlayerCountOnlyResp getVotePlayerCountOnly(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
                                                      @WebParam(name="regionCode")@QueryParam(value="regionCode")String regionCode,
                                                      @WebParam(name="status")@QueryParam(value="status")int status);
	
	/**
	 * 
	* @Title: addUserVote 
	* @Description: 添加用户票数
	* @param voteCode
	* @param userID
	* @param productID 产品编码组合，以逗号分割
	* @param epgType 1：标清；2：高清；3：4k
	* @return 
	* @return LuckyVoteResp 
	* @throws
	 */
	@GET
	@Path(value="addUserVote")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doAddUserVote",operationName="addUserVote")
    LuckyVoteResp addUserVote(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
                              @WebParam(name="userID")@QueryParam(value="userID")String userID,
                              @WebParam(name="productID")@QueryParam(value="productID")String productID,
                              @WebParam(name="epgType")@QueryParam(value="epgType")int epgType);
	
	/**
	 * 
	* @Title: reduceUserVote 
	* @Description: 减少用户票数
	* @param voteCode
	* @param userID
	* @param productID 产品编码组合，以逗号分割
	* @param epgType 1：标清；2：高清；3：4k
	* @return 
	* @return LuckyVoteResp 
	* @throws
	 */
	@GET
	@Path(value="reduceUserVote")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doReduceUserVote",operationName="reduceUserVote")
	LuckyVoteResp reduceUserVote(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode, 
			@WebParam(name="userID")@QueryParam(value="userID")String userID, 
			@WebParam(name="productID")@QueryParam(value="productID")String productID,
			@WebParam(name="epgType")@QueryParam(value="epgType")int epgType);
	
	/**
	 * 
	* @Title: getVoteCount 
	* @Description: 获取用户可投票数、剩余投票数
	* @param voteCode
	* @param userID
	* @param epgType 1：标清；2：高清；3：4k
	* @return 
	* @return LuckyVoteResp 
	* @throws
	 */
	@GET
	@Path(value="getVoteCount")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVoteCount",operationName="getVoteCount")
	LuckyVoteResp getVoteCount(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode, 
			@WebParam(name="userID")@QueryParam(value="userID")String userID,
			@WebParam(name="epgType")@QueryParam(value="epgType")int epgType);
	
	/**
	 * 
	* @Title: getDayVoteRecordCount 
	* @Description: 获取用户当天已投票次数
	* @param voteCode
	* @param userID
	* @param playerCode
	* @return 
	* @return GetDayVoteRecordCountResp 
	* @throws
	 */
	@GET
	@Path(value="getDayVoteRecordCount")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetDayVoteRecordCount",operationName="getDayVoteRecordCount")
    GetDayVoteRecordCountResp getDayVoteRecordCount(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
                                                    @WebParam(name="userID")@QueryParam(value="userID")String userID,
                                                    @WebParam(name="playerCode")@QueryParam(value="playerCode")String playerCode);
	
	/**
	 * 获取活动期间用户已投票次数
	 * @param voteCode
	 * @param userID
	 * @return
	 */
	@GET
	@Path(value="getPeriodVoteRecordCount")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetPeriodVoteRecordCount",operationName="getPeriodVoteRecordCount")
	GetPeriodVoteRecordCountResp getPeriodVoteRecordCount(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode, 
			@WebParam(name="userID")@QueryParam(value="userID")String userID,
			@WebParam(name="playerCode")@QueryParam(value="playerCode")String playerCode);
	
	/**
	 * 
	* @Title: luckyVote 
	* @Description: 投票
	* @param playerCode
	* @param userID
	* @param epgType 1：标清；2：高清；3：4k
	* @param votes 每次投票产生实际票数，0：系统设置，大于0则取votes具体值
	* @param areaId 投票用户所属区域
	* @return 
	* @return LuckyVoteResp 
	* @throws
	 */
	@GET
	@Path(value="luckyVote")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doLuckyVote",operationName="luckyVote")
	LuckyVoteResp luckyVote(@WebParam(name="playerCode")@QueryParam(value="playerCode")String playerCode, 
			@WebParam(name="userID")@QueryParam(value="userID")String userID,
			@WebParam(name="epgType")@QueryParam(value="epgType")int epgType,
			@WebParam(name="votes")@QueryParam(value="votes")int votes,
			@WebParam(name="areaId")@QueryParam(value="areaId")String areaId);
	
	/**
	 * 
	* @Title: getMonthChampion 
	* @Description: 获取投票活动某年月冠军榜
	* @param voteCode
	* @param whichYear
	* @param firstIndex
	* @param maxResult
	* @return 
	* @return GetVotePlayerListResp 
	* @throws
	 */
	@GET
	@Path(value="getMonthChampion")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetMonthChampion",operationName="getMonthChampion")
	GetVotePlayerListResp getMonthChampion(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
			@WebParam(name="whichYear")@QueryParam(value="whichYear")int whichYear,
			@WebParam(name="firstIndex")@QueryParam(value="firstIndex")int firstIndex, 
			@WebParam(name="maxResult")@QueryParam(value="maxResult")int maxResult);
	/**
	 * 
	* @Title: getMonthRank 
	* @Description: 获取投票活动某年某月排行榜
	* @param voteCode
	* @param whichYear
	* @param whichMonth
	* @param firstIndex
	* @param maxResult
	* @return 
	* @return GetVotePlayerListResp 
	* @throws
	 */
	@GET
	@Path(value="getMonthRank")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetMonthRank",operationName="getMonthRank")
	GetVotePlayerListResp getMonthRank(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
			@WebParam(name="whichYear")@QueryParam(value="whichYear")int whichYear,
			@WebParam(name="whichMonth")@QueryParam(value="whichMonth")int whichMonth,
			@WebParam(name="firstIndex")@QueryParam(value="firstIndex")int firstIndex, 
			@WebParam(name="maxResult")@QueryParam(value="maxResult")int maxResult);
	
	/**
	 * 
	* @Title: getWeekChampion 
	* @Description: 获取投票活动周冠军榜
	* @param voteCode
	* @param firstIndex
	* @param maxResult
	* @return 
	* @return GetVotePlayerListResp 
	* @throws
	 */
	@GET
	@Path(value="getWeekChampion")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetWeekChampion",operationName="getWeekChampion")
	GetVotePlayerListResp getWeekChampion(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
			@WebParam(name="firstIndex")@QueryParam(value="firstIndex")int firstIndex, 
			@WebParam(name="maxResult")@QueryParam(value="maxResult")int maxResult);
	
	/**
	 * 
	* @Title: getVotePlayer 
	* @Description: 获取选手信息
	* @param playerCode 选手编码
	* @param type 0：选手，1：冠军
	* @return 
	* @return GetVotePlayerResp 
	* @throws
	 */
	@GET
	@Path(value="getVotePlayer")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVotePlayer",operationName="getVotePlayer")
	GetVotePlayerResp getVotePlayer(@WebParam(name="playerCode")@QueryParam(value="playerCode")String playerCode,
			@WebParam(name="type")@QueryParam(value="type")int type);
	
	@GET
	@Path(value="searchVotePlayer")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doSearchVotePlayer",operationName="searchVotePlayer")
	GetVotePlayerResp searchVotePlayer(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
			@WebParam(name="playerNo")@QueryParam(value="playerNo")String playerNo,
			@WebParam(name="type")@QueryParam(value="type")int type);
	
	@GET
	@Path(value="searchVotePlayerList")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doSearchVotePlayerList",operationName="searchVotePlayerList")
	GetVotePlayerListResp searchVotePlayerList(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
			@WebParam(name="playerNo")@QueryParam(value="playerNo")String playerNo,
			@WebParam(name="sortName")@QueryParam(value="sortName")String sortName,
			@WebParam(name="sortOrder")@QueryParam(value="sortOrder")String sortOrder,
			@WebParam(name="type")@QueryParam(value="type")int type,
			@WebParam(name="firstIndex")@QueryParam(value="firstIndex")int firstIndex, 
			@WebParam(name="maxResult")@QueryParam(value="maxResult")int maxResult);
	
	/**
	 * 
	* @Title: getVoteRegionList 
	* @Description: 获取下级区域
	* @param regionCode 区域编码
	* @param retVotes 是否返回区域下所有选手投票总和:0-不返回，其他-返回，默认不返回
	* @param voteCode 投票活动编码， retVotes!=0时，需要指定返回具体哪一个活动
	* @param status 状态：0-启用，1-停用，2-启用与停用，默认启用
	* @param firstIndex
	* @param maxResult
	* @return 
	* @return GetVoteRegionListResp 
	* @throws
	 */
	@GET
	@Path(value="getVoteRegionList")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVoteRegionList",operationName="getVoteRegionList")
	GetVoteRegionListResp getVoteRegionList(@WebParam(name="regionCode")@QueryParam(value="regionCode")String regionCode,
			@WebParam(name="retVotes")@QueryParam(value="retVotes")int retVotes,
			@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
			@WebParam(name="status")@QueryParam(value="status")int status,
			@WebParam(name="firstIndex")@QueryParam(value="firstIndex")int firstIndex, 
			@WebParam(name="maxResult")@QueryParam(value="maxResult")int maxResult);
	
	/**
	 * 
	* @Title: getVoteRegionDetail 
	* @Description: 获取区域详情
	* @param regionCode 区域编码
	* @param retVotes 是否返回区域下所有选手投票总和:0-不返回，其他-返回，默认不返回
	* @param voteCode 投票活动编码， retVotes!=0时，需要指定返回具体哪一个活动
	* @return 
	* @return GetVoteRegionDetailResp 
	* @throws
	 */
	@GET
	@Path(value="getVoteRegionDetail")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVoteRegionDetail",operationName="getVoteRegionDetail")
	GetVoteRegionDetailResp getVoteRegionDetail(@WebParam(name="regionCode")@QueryParam(value="regionCode")String regionCode,
			@WebParam(name="retVotes")@QueryParam(value="retVotes")int retVotes,
			@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode);
	
	/**
	 * 
	* @Title: verifyInviteCode 
	* @Description: 验证邀请码
	* @param qrCode 二维码
	* @param inviteCode 邀请码
	* @param userID 用户账号
	* @return 
	* @return VerifyQrcodeResp 
	* @throws
	 */
	@GET
	@Path(value="verifyInviteCode")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doVerifyInviteCode",operationName="verifyInviteCode")
	VerifyInviteCodeResp verifyInviteCode (@WebParam(name="qrCode")@QueryParam(value="qrCode")String qrCode, 
			@WebParam(name="inviteCode")@QueryParam(value="inviteCode")String inviteCode,
			@WebParam(name="userID")@QueryParam(value="userID")String userID);
	
	/**
	 * 
	* @Title: getVoteQrCode 
	* @Description: 获取二维码详情
	* @param qrCode 二维码编码
	* @return 
	* @return GetVoteQrCodeResp 
	* @throws
	 */
	@GET
	@Path(value="getVoteQrCodeDetail")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVoteQrCodeDetail",operationName="getVoteQrCodeDetail")
	GetVoteQrCodeDetailResp getVoteQrCodeDetail(@WebParam(name="qrCode")@QueryParam(value="qrCode")String qrCode);
	
	/**
	 * 获取投票记录
	 * @param voteCode
	 * @param playerCode
	 * @param userID
	 * @param sortName
	 * @param sortOrder
	 * @param firstIndex
	 * @param maxResult
	 * @return
	 */
	@GET
	@Path(value="getVoteRecordList")
	@Produces(value=MediaType.APPLICATION_JSON )
	@WebMethod(action="doGetVoteRecordList",operationName="getVoteRecordList")
	GetVoteRecordListResp getVoteRecordList(@WebParam(name="voteCode")@QueryParam(value="voteCode")String voteCode,
			@WebParam(name="playerCode")@QueryParam(value="playerCode")String playerCode,
			@WebParam(name="userID")@QueryParam(value="userID")String userID,
			@WebParam(name="sortName")@QueryParam(value="sortName")String sortName,
			@WebParam(name="sortOrder")@QueryParam(value="sortOrder")String sortOrder,
			@WebParam(name="firstIndex")@QueryParam(value="firstIndex")int firstIndex, 
			@WebParam(name="maxResult")@QueryParam(value="maxResult")int maxResult);
}

